import _axios from 'axios'
import qs from 'qs'
import { setCookie } from '../utils/index.js'
// 创建一个 Axios 实例，并配置 `withCredentials` 为 `true`
const axios = _axios.create({
  withCredentials: true,
})
axios.interceptors.response.use(
  function (response) {
    // 对响应数据做点什么
    return response
  },
  function (error) {
    // console.log('error>>>>>>', error.response.data)
    return (error.response && error.response.data) || '请求失败'
  },
)
export default axios
